/**
 * @param {number[]} nums
 * @return {number}
 */
var maxAscendingSum = function (nums) {
    if (nums.length === 0) return;
    [[1, 2], [2]]
    let tempStr = [[nums[0]]];
    for (let i = 1; i < nums.length; i++) {
        if (nums[i] > tempStr[tempStr.length - 1][tempStr[tempStr.length - 1].length - 1]) {
            tempStr[tempStr.length - 1].push(nums[i]);
        } else {
            tempStr.push([nums[i]]);
        }
    }
    return tempStr.reduce((last, now) => last > calc(now) ? last : calc(now), 0);
};
console.log(maxAscendingSum([10, 20, 30, 5, 10, 50]));
/**
 * @description 计算数组和
 * @param {number[]} arr 
 * @returns {number} 数组和
 */
function calc(arr) {
    return arr.reduce((last, now) => last + now, 0);
}